package com.jye.cloud.user.service.impl;


import com.jye.cloud.domain.Follow;
import com.jye.cloud.user.service.FollowService;
import com.jye.cloud.user.mapper.FollowMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FollowServiceImpl implements FollowService {

    @Autowired
    FollowMapper followMapper;

    @Override
    public int doFollow(Follow follow) {
        try{
            int i = followMapper.isExist(follow);
            if(i==0){
                //不存在,插入数据
                followMapper.addFollow(follow);

            }else{
                //已存在,更新状态即可
                followMapper.updateStatus(follow);
            }
            return 1;
        }catch (Exception e){
            return 0;
        }
    }


}
